package com.example.securityproject.demos.common;

import lombok.Getter;

/**
 * @Author: Jiangjb
 * @CreateTime: 2022-06-25  00:01
 * @Description: 自定义异常
 */
@Getter
public class BusinessException extends RuntimeException {
    /*
     * 错误码
     **/
    private final int code;

    /*
     * 错误信息
     **/
    private final String description;

    public BusinessException(String message, int code, String description) {
        super(message);
        this.code = code;
        this.description = description;
    }

    public BusinessException(ResultCode resultCode, String description) {
        super(resultCode.getMessage());
        this.code = resultCode.getCode();
        this.description = description;
    }

    public BusinessException(int code, String description) {
        this.code = code;
        this.description = description;
    }
}


